﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ETALON
{
    public partial class FormM : Form
    {
        public bool IsSelect;
        string l1, l2, l3, l4; 
        public FormM()
        {
            InitializeComponent(); InitializeComponentMy();
        }

        void InitializeComponentMy()
        {
            l1 = "00"; l2 = "00"; l3 = "00"; l4 = "00"; IsSelect = false;
            for (int j = 0; j < 100; j++)
            {
                listBox1.Items.Add(j); listBox2.Items.Add(j); listBox3.Items.Add(j); listBox4.Items.Add(j);
            }
        }

        private void listBox1_SelectedValueChanged(object sender, EventArgs e)
        {
            try
            {
                l1 = (listBox1.SelectedItem.ToString());
                toolStripLabel2.Text = selectValue;// q();
            }
            catch { }
        }

        public string selectValue
        {
            get
            {
                string r = "000000,00";
                r =  Convert.ToDouble( string.Concat(l1, nn(l2) , nn(l3), ",", l4)).ToString();
                return r;
            }
        }
        private string nn(object o)
        {
            string s = "0";
            if (Convert.ToInt32(o) < 10 && Convert.ToInt32(o) > 0) { s = string.Concat("0", o); } else { s = o.ToString(); }
            return s;
        }

        private void listBox2_SelectedValueChanged(object sender, EventArgs e)
        {
            try
            {

                l2 = (listBox2.SelectedItem.ToString());

                toolStripLabel2.Text = selectValue;// q();
            }
            catch { }
        }

        private void listBox3_SelectedValueChanged(object sender, EventArgs e)
        {
            try
            {

                l3 = (listBox3.SelectedItem.ToString());

                toolStripLabel2.Text = selectValue;// q();
            }
            catch { }
        }

        private void listBox4_SelectedValueChanged(object sender, EventArgs e)
        {
            try
            {

                l4 = (listBox4.SelectedItem.ToString());

                toolStripLabel2.Text = selectValue; q();
            }
            catch { }
        }
        void q()
        {
            IsSelect = true; this.Close();
        }

        private void listBox1_DoubleClick(object sender, EventArgs e)
        {
            q();
        }

        private void listBox2_DoubleClick(object sender, EventArgs e)
        {
            q();
        }

        private void listBox3_DoubleClick(object sender, EventArgs e)
        {
            q();
        }

        
    }
}
